home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Net / Utilities / Seer family 2.0 / seer_common / sc_pdl_rsrc_readr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-11-18  |  2.3 KB  |  85 lines  |  [TEXT/KAHL]

  1. /*
  2.     sc_pdl_rsrc_readr.c - pdl resource reader
  3. */
  4. #include "sc.h"
  5. #include "pdl_data.h"
  6. #include "sc_pdl_dat.h"
  7. #include "sc_filter.h"
  8.  
  9. #define PDLc_id 256
  10. #define PDLs_id 256
  11.  
  12.  
  13. /*
  14.     fill in the names in cnt_tab from the field opcode pointed to
  15.     by a_cres
  16. */
  17. void name_counts(nd_res*,cnt_tab*);
  18. void name_counts(a_cres,acnt_tab)
  19. nd_res* a_cres;
  20. cnt_tab *acnt_tab;
  21. {register long counter_num;
  22.  acnt_tab->tab_nam=a_cres->nd_str;    /*name the table*/
  23.  a_cres++;        /*skip the field opcode, to the names*/
  24.  while((a_cres->nd_type==IS_NAME)||
  25.         (a_cres->nd_type==IS_PROTO)) {
  26.   /* see which counter to name */
  27.   counter_num=a_cres->nd_value;
  28.   /*can't have values out of the counter range*/
  29.   if((counter_num<0)||
  30.      (counter_num>=CNT_SIZE))
  31.       bomb(BOMB_nopdl,0,BMB_no_special);
  32.   /* remember the counter name*/
  33.   acnt_tab->acnt_tab[counter_num].filname=a_cres->nd_str;
  34.   /* want to default to rejecting packets for this counter?*/
  35.   if((a_cres->nd_cntr_flags&CNTR_reject_real)!=0)
  36.       acnt_tab->acnt_tab[counter_num].reject=1;    /*yes, set reject bit*/
  37.   acnt_tab->acnt_tab[counter_num].filflags=a_cres->nd_cntr_flags;
  38.   a_cres++;        /* step to the next opcdode */
  39.   }
  40. }
  41.  
  42. /*
  43.     pdl_opn_res - open and load the pdl resource
  44. */
  45. void pdl_opn_res()
  46. {int old_res;
  47.  uint8 **pdl_cod_handle;    /*pdl string data structure handle */
  48.  uint8 **pdl_str_handle;    /*pdl code data structure handle */
  49.  
  50.  old_res=CurResFile();
  51.  
  52.  gl.pdl_res=OpenResFile("\ppdl.rsrc");
  53.  if(gl.pdl_res == -1)
  54.      bomb(BOMB_nopdl,ResError(),BMB_no_special);
  55.  UseResFile(gl.pdl_res);
  56.  
  57.  pdl_str_handle=(uint8 **)GetResource('PDLs',PDLs_id);
  58.  if(pdl_str_handle==NIL)
  59.      bomb(BOMB_nopdl,ResError(),BMB_no_special);
  60.  HLock(pdl_str_handle);
  61.  gl.pdl_str_ptr= *pdl_str_handle;
  62.  
  63.  pdl_cod_handle=(uint8 **)GetResource('PDLc',PDLc_id);
  64.  if(pdl_cod_handle==NIL)
  65.       bomb(BOMB_nopdl,ResError(),BMB_no_special);
  66.  HLock(pdl_cod_handle);
  67.  gl.pdl_cod_ptr= *pdl_cod_handle;
  68.  
  69.  UseResFile(old_res);
  70.  
  71.  
  72.  /* the pdl resources have been read in, now build the counter name
  73.     tables
  74.  */
  75.  /* fill in the names for lap types*/
  76.  name_counts(RES_cod(PDL_WORLD->counts[lap_cntr]),
  77.      &my_filter.counts[lap_ty_tbi]);
  78.  /* fill in the names for ddp types*/
  79.  name_counts(RES_cod(PDL_WORLD->counts[ddp_cntr]),
  80.      &my_filter.counts[ddp_ty_tbi]);
  81.  /* fill in the names for lap types*/
  82.  name_counts(RES_cod(PDL_WORLD->counts[misc_cntr]),
  83.      &my_filter.counts[err_tbi]);
  84. }
  85.